﻿#pragma once
#include <map>
#include <vector>
#include <string>
#include <unordered_map>

class SolarUtil
{

public:
	/// <summary>
	/// 星期
	/// </summary>
	static const std::vector<std::string>  WEEK;

	/// <summary>
	/// 每月天数
	/// </summary>
	static const std::vector<int> DAYS_OF_MONTH;

	/// <summary>
	/// 星座
	/// </summary>
	static const std::vector<std::string> XING_ZUO;


	/// <summary>
	/// 节日
	/// </summary>
	static const std::unordered_map<std::string, std::string> FESTIVAL;


	/// <summary>
	/// 按星期的节日
	/// </summary>
	static std::unordered_map<std::string, std::string> WEEK_FESTIVAL;

	/// <summary>
	/// 非正式节日
	/// </summary>
	static std::unordered_map<std::string, std::vector<std::string>> OTHER_FESTIVAL;

	/// <summary>
	/// 是否闰年
	/// </summary>
	/// <param name="year">年</param>
	/// <returns>true/false 闰年/非闰年</returns>
	static bool IsLeapYear(int year);


	/// <summary>
	/// 获取某年有多少天（平年365天，闰年366天）
	/// </summary>
	/// <param name="year">年</param>
	/// <returns>天数</returns>
	static int GetDaysOfYear(int year);

	/// <summary>
	/// 获取某年某月有多少天
	/// </summary>
	/// <param name="year">年</param>
	/// <param name="month">月</param>
	/// <returns>天数</returns>
	static int GetDaysOfMonth(int year, int month);

	/// <summary>
	/// 获取某天为当年的第几天
	/// </summary>
	/// <param name="year">年</param>
	/// <param name="month">月</param>
	/// <param name="day">日</param>
	/// <returns>第几天</returns>
	static int GetDaysInYear(int year, int month, int day);


	/// <summary>
	/// 获取某年某月有多少周
	/// </summary>
	/// <param name="year">年</param>
	/// <param name="month">月</param>
	/// <param name="start">星期几作为一周的开始，1234560分别代表星期一至星期天</param>
	/// <returns>周数</returns>
	static int GetWeeksOfMonth(int year, int month, int start);


	/// <summary>
	/// 获取两个日期之间相差的天数（如果日期a比日期b小，天数为正，如果日期a比日期b大，天数为负）
	/// </summary>
	/// <param name="ay">年a</param>
	/// <param name="am">月a</param>
	/// <param name="ad">日a</param>
	/// <param name="by">年b</param>
	/// <param name="bm">月b</param>
	/// <param name="bd">日b</param>
	/// <returns>天数</returns>
	static int GetDaysBetween(int ay, int am, int ad, int by, int bm, int bd);


};

